<?php
    include_once '../Datos/GestionNoticias.php';
    include_once '../Datos/Noticia.php';
    
    $gestion = new GestionNoticias();
    try{    
        $listanoticas = $gestion->getListaUltimasNoticia();
        echo "<table>";
        if($listanoticas != "ERROR"){
            foreach ($listanoticas as $value) {
                echo "<tr><td>";
                echo "<a class='tituloNoticia' onclick='AbrirNoticia(".$value->getNotica_id().")'>".$value->getNombre()." (".$value->getFecha().")</a> ";
                echo "</td></tr>";
            }        
            echo "</table>";
        }
    }catch (Exception $e)
    {
        echo "No existen Noticias";
    }
?>
